package com.jwthhealth_pub.old.acupressure.view.adapter;

import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.jwthhealth_pub.R;
import com.jwthhealth_pub.old.acupressure.module.AcupressureJztzjldetailModule;
import com.jwthhealth_pub.old.acupressure.view.NineConstitutionActivity;

import java.util.List;

/**
 * Created by Administrator on 2017/1/13
 */
public class NineConstitutionDescAdapter extends RecyclerView.Adapter {

    private NineConstitutionActivity mActivity;
    private List<AcupressureJztzjldetailModule.DataBean.DescBean> mData;

    public NineConstitutionDescAdapter(NineConstitutionActivity nineConstitution, List<AcupressureJztzjldetailModule.DataBean.DescBean> mData) {
        this.mActivity = nineConstitution;
        this.mData = mData;
    }

    @Override
    public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View view = View.inflate(mActivity, R.layout.item_nineconstitution, null);
        return new ViewHolder(view);
    }

    @Override
    public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
        final ViewHolder vh = (ViewHolder) holder;
        AcupressureJztzjldetailModule.DataBean.DescBean descBean = mData.get(position);

        vh.name.setText(descBean.getName());
        vh.desc.setText(descBean.getDesc());

    }

    @Override
    public int getItemCount() {
        return mData.size();
    }

    class ViewHolder extends RecyclerView.ViewHolder {

        TextView name, desc;
        ImageView arrow;

        boolean isShow;

        public ViewHolder(View itemView) {
            super(itemView);
            name = itemView.findViewById(R.id.name);
            desc = itemView.findViewById(R.id.desc);
            arrow = itemView.findViewById(R.id.arrow);
        }
    }
}
